package com.engine.annual.cmd;

import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import weaver.conn.RecordSet;
import weaver.hrm.User;

import java.util.HashMap;
import java.util.Map;

public class AnnualDelCmd extends AbstractCommonCommand<Map<String, Object>> {

    public AnnualDelCmd(User user, Map<String, Object> params) {
        this.user = user;
        this.params = params;
    }

    @Override
    public BizLogContext getLogContext() {
        return null;
    }

    @Override
    public Map<String, Object> execute(CommandContext commandContext) {
        HashMap<String, Object> result = new HashMap<>();
        RecordSet recordSet = new RecordSet();

        boolean flag = recordSet.execute("delete from t_annual where ID =" + params.get("id"));
        if (flag) {
            result.put("api_msg", "删除成功");
        } else {
            result.put("api_msg", "删除失败");
        }
        return result;
    }
}
